

import java.util.ArrayList;



public class MethodsDecl {

	ArrayList<MethodDecl> methods;

	public MethodsDecl() {
		methods = new ArrayList<MethodDecl>();
	}

	public void addMethodDecl(MethodDecl method) {
		methods.add(method);
	}

	public void check() throws SemanticException {
		SymbolTable table = SymbolTable.getInstance();
		table.openScope();
		for (MethodDecl m : methods) {
			m.checkDefinition();
		}
		for (MethodDecl m : methods) {
			m.check();
		}
		table.closeScope();
	}

	public String toString() {
		if (methods.size() == 0)
			return "";
		String ret = "MethodsDecl\n";
		String s = "";
		for (MethodDecl e : methods)
			s += e.toString();
		for (String st : s.split("\n"))
			ret += "| " + st + "\n";
		return ret;
	}
}
